package pl.iachoo.ctl.tabory.dao.core.mybatis.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import pl.iachoo.ctl.tabory.dao.data.vo.UserRoleVO;

public interface UserRoleMapper {

	final static String SELECT_ALL = "select * from ctl.user_roles";
	final static String SELECT_BY_ID = "select * from ctl.user_roles where id = #{id}";

	@Select(SELECT_ALL)
	@Results(value = { @Result(property = "id", column = "ID"),
			@Result(property = "roleName", column = "ROLE_NAME") })
	public List<UserRoleVO> getAllRoles() throws Exception;

	@Select(SELECT_BY_ID)
	@Results(value = { @Result(property = "id", column = "ID"),
			@Result(property = "roleName", column = "ROLE_NAME") })
	public UserRoleVO getById(Long id) throws Exception;

}
